
/*-------------------------------------------------------------------------
 *
 * pg_policy.h
 *	  "策略" 系统目录 (pg_policy) 的定义
 *
 *
 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/catalog/pg_policy.h
 *
 * NOTES
 *	  Catalog.pm 模块读取此文件并推导模式信息。
 *
 *-------------------------------------------------------------------------
 */
#ifndef PG_POLICY_H
#define PG_POLICY_H

#include "catalog/genbki.h"
#include "catalog/pg_policy_d.h"

/* ----------------
 *		pg_policy 定义。 cpp 将其转换为
 *		typedef struct FormData_pg_policy
 * ----------------
 */
CATALOG(pg_policy,3256,PolicyRelationId)
{
	Oid			oid;			/* oid */
	NameData	polname;		/* 策略名称。 */
	Oid			polrelid BKI_LOOKUP(pg_class);	/* 与策略相关的关系的 Oid。 */
	char		polcmd;			/* 其中一个 ACL_*_CHR，或 '*' 表示所有 */
	bool		polpermissive;	/* 限制性或宽松策略 */

#ifdef CATALOG_VARLEN
	/* 应用策略的角色；零表示 PUBLIC */
	Oid			polroles[1] BKI_LOOKUP_OPT(pg_authid) BKI_FORCE_NOT_NULL;
	pg_node_tree polqual;		/* 策略条件。 */
	pg_node_tree polwithcheck;	/* WITH CHECK 条件。 */
#endif
} FormData_pg_policy;

/* ----------------
 *		Form_pg_policy 对应于具有 pg_policy 关系格式的行的指针。
 * ----------------
 */
typedef FormData_pg_policy *Form_pg_policy;

DECLARE_TOAST(pg_policy, 4167, 4168);

DECLARE_UNIQUE_INDEX_PKEY(pg_policy_oid_index, 3257, PolicyOidIndexId, on pg_policy using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_policy_polrelid_polname_index, 3258, PolicyPolrelidPolnameIndexId, on pg_policy using btree(polrelid oid_ops, polname name_ops));

#endif							/* PG_POLICY_H */
